package com.idealighter.game.web.checklevel.fqzs.controller;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.idealighter.game.core.result.Result;
import com.idealighter.game.web.checklevel.fqzs.controller.convert.FqzsCheckResultDtoConvert;
import com.idealighter.game.web.checklevel.fqzs.controller.dto.FqzsIconInputDto;
import com.idealighter.game.web.checklevel.fqzs.service.FqzsBasicControlCheck;
import com.idealighter.game.web.checklevel.fqzs.service.bo.FqzsCheckResultBo;
import com.idealighter.utils.json.JsonUtil;
import java.util.List;
import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

@Path("/checkLevel/fqzs")
@Singleton
public class FqzsCheckLevelController {
  @Inject
  private FqzsBasicControlCheck basicControlCheck;

  /**
   * .
   * 
   * @param icongs .
   * @return .
   */
  @Produces("application/json; charset=utf-8")
  @POST
  public Result checkBasic(@FormParam("icongs") String icongs) {
    // 水果拉霸基础档位测试
    List<FqzsIconInputDto> basicInputs = JsonUtil.fromJsonToList(icongs, FqzsIconInputDto.class);
    FqzsCheckResultBo checkResult = basicControlCheck.checkList(basicInputs);
    Result result = new Result(true);
    result.getMap().put("result", FqzsCheckResultDtoConvert.INSTANCE.bo2dto(checkResult));
    return result;
  }
}
